import request from '@/utils/request'

// 账户管理接口
export const accountApi = {
  // 获取账户列表
  getList(params) {
    return request({
      url: '/account/list',
      method: 'get',
      params
    })
  },
  
  // 创建账户
  create(data) {
    return request({
      url: '/account',
      method: 'post',
      data
    })
  },
  
  // 存款
  deposit(data) {
    return request({
      url: '/account/deposit',
      method: 'post',
      data
    })
  },
  
  // 取款
  withdraw(data) {
    return request({
      url: '/account/withdraw',
      method: 'post',
      data
    })
  },
  
  // 冻结账户
  freeze(accountId, remark) {
    return request({
      url: `/account/freeze/${accountId}`,
      method: 'post',
      params: { remark }
    })
  },
  
  // 解冻账户
  unfreeze(accountId, remark) {
    return request({
      url: `/account/unfreeze/${accountId}`,
      method: 'post',
      params: { remark }
    })
  },
  
  // 获取账户详情
  getInfo(accountNo) {
    return request({
      url: `/account/info/${accountNo}`,
      method: 'get'
    })
  },
  
  // 获取账户交易记录
  getTransactions(accountNo, params) {
    return request({
      url: `/account/transactions/${accountNo}`,
      method: 'get',
      params
    })
  },
  
  // 之前的状态更新接口可以保留作为备用
  updateStatus(accountNo, status) {
    return request({
      url: `/account/status`,
      method: 'put',
      data: {
        accountNo,
        status
      }
    })
  }
} 